package com.quick.develop.framework.common.enums;

import com.quick.develop.framework.common.exception.ErrorCode;
import lombok.Getter;

@Getter
public enum ServerError {

    /**
     * 服务器错误
     */
    SERVER_ERROR(500, "服务器错误"),
    /**
     * 服务器异常
     */
    SERVER_EXCEPTION(503, "服务器异常"),
    /**
     * 服务器超时
     */
    SERVER_TIMEOUT(504, "服务器超时"),

    UNAUTHORIZED(401, "还未授权，不能访问"),
    FORBIDDEN(403, "没有权限，禁止访问"),
    REFRESH_TOKEN_INVALID(400, "refresh_token 已失效"),
    INTERNAL_SERVER_ERROR(500, "服务器异常，请稍后再试");

    private final ErrorCode errorCode;

    ServerError(Integer code, String message) {
        this.errorCode = new ErrorCode(code, message);
    }
    
    public int getCode() {
        return errorCode.getCode();
    }
    
    public String getMsg(){
        return errorCode.getMsg();
    }
}
